# Contributor: Patrycja Rosa <alpine@ptrcnull.me>
# Maintainer: Patrycja Rosa <alpine@ptrcnull.me>
pkgname=bento4
_pkgver=1.6.0-639
pkgver=${_pkgver/-/.}
pkgrel=0
pkgdesc="Full-featured MP4 format, MPEG DASH, HLS, CMAF SDK and tools"
url="https://bento4.com"
arch="all !s390x !ppc64le" # fails to build
license="GPL-2.0-only"
makedepends="cmake samurai"
subpackages="$pkgname-dev"
source="https://github.com/axiomatic-systems/Bento4/archive/v$_pkgver/bento4-$_pkgver.tar.gz
	riscv64.patch
	"
builddir="$srcdir/Bento4-$_pkgver"
options="!check" # no meaningful tests available

build() {
	cmake -G Ninja -B build \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=lib \
		-DBUILD_SHARED_LIBS=True \
		-DCMAKE_BUILD_TYPE=MinSizeRel \
		$CMAKE_CROSSOPTS .
	cmake --build build
}

package() {
	# no CMake install target
	cd "$builddir"/build
	install -Dm644 *.a -t "$pkgdir"/usr/lib/
	install -Dm755 -t "$pkgdir"/usr/bin/ \
		mp4* \
		aac2mp4 \
		avcinfo \
		fixaacsampledescription \
		hevcinfo
}

sha512sums="
6c3371c967f914032239eb24748a366e18061d5c623a746c3d090e22768dcf405cd572bf8a03e2b6a8dffbba348d34d456a2ab578841c3028cdd8a68f558b9f6  bento4-1.6.0-639.tar.gz
58eb058878e113b3fe7a4ede7179239027e61c334c91bebb24677125447144b2bf3c331edd10c1679b85acff70900364b1feddb1b5bb809deb687da99efc9d18  riscv64.patch
"
